Optimal. Leaf size=221 \[ -\frac {3 a x}{b^4}+\frac {3 a^2 \left (2 a^4-5 a^2 b^2+4 b^4\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} b^4 (a+b)^{5/2} d}+\frac {\left (3 a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.33, antiderivative size = 221, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {2871, 3110,
3102, 2814, 2738, 211} \begin {gather*} -\frac {a^2 \sin (c+d x) \cos ^2(c+d x)}{2 b d \left (a^2-b^2\right ) (a+b \cos (c+d x))^2}+\frac {\left (3 a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 d \left (a^2-b^2\right )}+\frac {3 a^2 \left (2 a^4-5 a^2 b^2+4 b^4\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^4 d (a-b)^{5/2} (a+b)^{5/2}}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 d \left (a^2-b^2\right )^2 (a+b \cos (c+d x))}-\frac {3 a x}{b^4} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 2738
Rule 2814
Rule 2871
Rule 3102
Rule 3110
Rubi steps
\begin {align*} \int \frac {\cos ^4(c+d x)}{(a+b \cos (c+d x))^3} \, dx &=-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}-\frac {\int \frac {\cos (c+d x) \left (2 a^2-2 a b \cos (c+d x)-\left (3 a^2-2 b^2\right ) \cos ^2(c+d x)\right )}{(a+b \cos (c+d x))^2} \, dx}{2 b \left (a^2-b^2\right )}\\ &=-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))}-\frac {\int \frac {3 a^2 b \left (a^2-2 b^2\right )+a \left (3 a^2-4 b^2\right ) \left (a^2-b^2\right ) \cos (c+d x)-b \left (3 a^2-2 b^2\right ) \left (a^2-b^2\right ) \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx}{2 b^3 \left (a^2-b^2\right )^2}\\ &=\frac {\left (3 a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))}-\frac {\int \frac {3 a^2 b^2 \left (a^2-2 b^2\right )+6 a b \left (a^2-b^2\right )^2 \cos (c+d x)}{a+b \cos (c+d x)} \, dx}{2 b^4 \left (a^2-b^2\right )^2}\\ &=-\frac {3 a x}{b^4}+\frac {\left (3 a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))}+\frac {\left (3 a^2 \left (2 a^4-5 a^2 b^2+4 b^4\right )\right ) \int \frac {1}{a+b \cos (c+d x)} \, dx}{2 b^4 \left (a^2-b^2\right )^2}\\ &=-\frac {3 a x}{b^4}+\frac {\left (3 a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))}+\frac {\left (3 a^2 \left (2 a^4-5 a^2 b^2+4 b^4\right )\right ) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^4 \left (a^2-b^2\right )^2 d}\\ &=-\frac {3 a x}{b^4}+\frac {3 a^2 \left (2 a^4-5 a^2 b^2+4 b^4\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} b^4 (a+b)^{5/2} d}+\frac {\left (3 a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right ) d}-\frac {a^2 \cos ^2(c+d x) \sin (c+d x)}{2 b \left (a^2-b^2\right ) d (a+b \cos (c+d x))^2}+\frac {3 a^3 \left (a^2-2 b^2\right ) \sin (c+d x)}{2 b^3 \left (a^2-b^2\right )^2 d (a+b \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.51, size = 177, normalized size = 0.80 \begin {gather*} \frac {-6 a (c+d x)-\frac {6 a^2 \left (2 a^4-5 a^2 b^2+4 b^4\right ) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{5/2}}+2 b \sin (c+d x)-\frac {a^4 b \sin (c+d x)}{(a-b) (a+b) (a+b \cos (c+d x))^2}+\frac {a^3 b \left (5 a^2-8 b^2\right ) \sin (c+d x)}{(a-b)^2 (a+b)^2 (a+b \cos (c+d x))}}{2 b^4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.51, size = 266, normalized size = 1.20
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (-\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+3 a \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{b^{4}}+\frac {2 a^{2} \left (\frac {\frac {\left (4 a^{2}-a b -8 b^{2}\right ) a b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 \left (a -b \right ) \left (a^{2}+2 a b +b^{2}\right )}+\frac {\left (4 a^{2}+a b -8 b^{2}\right ) a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a +b \right ) \left (a^{2}-2 a b +b^{2}\right )}}{\left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )^{2}}+\frac {3 \left (2 a^{4}-5 a^{2} b^{2}+4 b^{4}\right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b^{4}}}{d}\) | \(266\) |
default | \(\frac {-\frac {2 \left (-\frac {b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}+3 a \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )\right )}{b^{4}}+\frac {2 a^{2} \left (\frac {\frac {\left (4 a^{2}-a b -8 b^{2}\right ) a b \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2 \left (a -b \right ) \left (a^{2}+2 a b +b^{2}\right )}+\frac {\left (4 a^{2}+a b -8 b^{2}\right ) a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a +b \right ) \left (a^{2}-2 a b +b^{2}\right )}}{\left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )^{2}}+\frac {3 \left (2 a^{4}-5 a^{2} b^{2}+4 b^{4}\right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{2 \left (a^{4}-2 a^{2} b^{2}+b^{4}\right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b^{4}}}{d}\) | \(266\) |
risch | \(-\frac {3 a x}{b^{4}}-\frac {i {\mathrm e}^{i \left (d x +c \right )}}{2 b^{3} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )}}{2 b^{3} d}+\frac {i a^{3} \left (6 a^{3} b \,{\mathrm e}^{3 i \left (d x +c \right )}-9 a \,b^{3} {\mathrm e}^{3 i \left (d x +c \right )}+10 a^{4} {\mathrm e}^{2 i \left (d x +c \right )}-11 a^{2} b^{2} {\mathrm e}^{2 i \left (d x +c \right )}-8 b^{4} {\mathrm e}^{2 i \left (d x +c \right )}+14 a^{3} b \,{\mathrm e}^{i \left (d x +c \right )}-23 a \,b^{3} {\mathrm e}^{i \left (d x +c \right )}+5 a^{2} b^{2}-8 b^{4}\right )}{b^{4} \left (a^{2}-b^{2}\right )^{2} d \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )^{2}}-\frac {3 a^{6} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,b^{4}}+\frac {15 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{2 \sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,b^{2}}-\frac {6 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}+\frac {3 a^{6} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,b^{4}}-\frac {15 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{2 \sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d \,b^{2}}+\frac {6 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right )}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}\) | \(730\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 480 vs.
\(2 (206) = 412\).
time = 0.48, size = 1029, normalized size = 4.66 \begin {gather*} \left [-\frac {12 \, {\left (a^{7} b^{2} - 3 \, a^{5} b^{4} + 3 \, a^{3} b^{6} - a b^{8}\right )} d x \cos \left (d x + c\right )^{2} + 24 \, {\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} d x \cos \left (d x + c\right ) + 12 \, {\left (a^{9} - 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} - a^{3} b^{6}\right )} d x + 3 \, {\left (2 \, a^{8} - 5 \, a^{6} b^{2} + 4 \, a^{4} b^{4} + {\left (2 \, a^{6} b^{2} - 5 \, a^{4} b^{4} + 4 \, a^{2} b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (2 \, a^{7} b - 5 \, a^{5} b^{3} + 4 \, a^{3} b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - 2 \, {\left (6 \, a^{8} b - 17 \, a^{6} b^{3} + 13 \, a^{4} b^{5} - 2 \, a^{2} b^{7} + 2 \, {\left (a^{6} b^{3} - 3 \, a^{4} b^{5} + 3 \, a^{2} b^{7} - b^{9}\right )} \cos \left (d x + c\right )^{2} + {\left (9 \, a^{7} b^{2} - 25 \, a^{5} b^{4} + 20 \, a^{3} b^{6} - 4 \, a b^{8}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, {\left ({\left (a^{6} b^{6} - 3 \, a^{4} b^{8} + 3 \, a^{2} b^{10} - b^{12}\right )} d \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b^{5} - 3 \, a^{5} b^{7} + 3 \, a^{3} b^{9} - a b^{11}\right )} d \cos \left (d x + c\right ) + {\left (a^{8} b^{4} - 3 \, a^{6} b^{6} + 3 \, a^{4} b^{8} - a^{2} b^{10}\right )} d\right )}}, -\frac {6 \, {\left (a^{7} b^{2} - 3 \, a^{5} b^{4} + 3 \, a^{3} b^{6} - a b^{8}\right )} d x \cos \left (d x + c\right )^{2} + 12 \, {\left (a^{8} b - 3 \, a^{6} b^{3} + 3 \, a^{4} b^{5} - a^{2} b^{7}\right )} d x \cos \left (d x + c\right ) + 6 \, {\left (a^{9} - 3 \, a^{7} b^{2} + 3 \, a^{5} b^{4} - a^{3} b^{6}\right )} d x - 3 \, {\left (2 \, a^{8} - 5 \, a^{6} b^{2} + 4 \, a^{4} b^{4} + {\left (2 \, a^{6} b^{2} - 5 \, a^{4} b^{4} + 4 \, a^{2} b^{6}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (2 \, a^{7} b - 5 \, a^{5} b^{3} + 4 \, a^{3} b^{5}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (6 \, a^{8} b - 17 \, a^{6} b^{3} + 13 \, a^{4} b^{5} - 2 \, a^{2} b^{7} + 2 \, {\left (a^{6} b^{3} - 3 \, a^{4} b^{5} + 3 \, a^{2} b^{7} - b^{9}\right )} \cos \left (d x + c\right )^{2} + {\left (9 \, a^{7} b^{2} - 25 \, a^{5} b^{4} + 20 \, a^{3} b^{6} - 4 \, a b^{8}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{6} b^{6} - 3 \, a^{4} b^{8} + 3 \, a^{2} b^{10} - b^{12}\right )} d \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b^{5} - 3 \, a^{5} b^{7} + 3 \, a^{3} b^{9} - a b^{11}\right )} d \cos \left (d x + c\right ) + {\left (a^{8} b^{4} - 3 \, a^{6} b^{6} + 3 \, a^{4} b^{8} - a^{2} b^{10}\right )} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.46, size = 354, normalized size = 1.60 \begin {gather*} -\frac {\frac {3 \, {\left (2 \, a^{6} - 5 \, a^{4} b^{2} + 4 \, a^{2} b^{4}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{4} b^{4} - 2 \, a^{2} b^{6} + b^{8}\right )} \sqrt {a^{2} - b^{2}}} - \frac {4 \, a^{6} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 5 \, a^{5} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 7 \, a^{4} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 8 \, a^{3} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 4 \, a^{6} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 5 \, a^{5} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 7 \, a^{4} b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 8 \, a^{3} b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b\right )}^{2}} + \frac {3 \, {\left (d x + c\right )} a}{b^{4}} - \frac {2 \, \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )} b^{3}}}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.23, size = 2500, normalized size = 11.31 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________